package drds.configuration.db.xml_mapping.dynamic_tag.tag;


import drds.configuration.db.xml_mapping.dynamic_tag.ognl.Ognl;
import drds.configuration.db.xml_mapping.dynamic_tag.tag_context.TagContext;

public class BindTag implements Tag {

    private final String name;
    private final String expression;

    public BindTag(String name, String expression) {
        this.name = name;
        this.expression = expression;
    }

    @Override
    public boolean apply(TagContext tagContext) {
        final Object value = Ognl.getValue(tagContext.getTagContextMap(), expression);
        tagContext.put(name, value);
        return true;
    }
}
